# -*- coding: utf-8 -*-
# File: demo_2.py
# Time: 2022/01/18 14:38:22
# Author: selfeasy
# Email: selfeasy@qq.com
# description: 


class Demo(object):
    def __new__(cls, *args, **kwargs):#cls代表Demo类本身
        print("this is new method")
        return object.__new__(cls)
    
    def __init__(self,*arg, **kwargs):
        print("this is init method")
        # 在执行__init__的时候, __new__的返回值会自动作为参数传递给这里的self


if __name__ == "__main__":
    Demo(1,12)

'''
一个对象是什么，取决于其类型对象的__new__返回了什么
参数一定要对应，__new__里面的参数一定要和__init__是匹配的, 除了第一个参数之外
'''